package com.cjack.frenchexcel.dao;

import com.cjack.frenchexcel.table.SendGoodsRecordTable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;


public interface SendGoodsRecordDao extends JpaRepository<SendGoodsRecordTable, Long>, JpaSpecificationExecutor<SendGoodsRecordTable> {

    public int countBySendGoodsNoProfix( String sendGoodsNoNumber);

    /**
     * 根据上传出关单时间统计时间段内该员工所有的出口总额总额
     * @return
     */
    @Query( value = " select IFNULL( ROUND( sum(total_amount), 2), 0)total_amount from fe_sendgoods where admin_user_id=?1 and upload_customs_clearance_form_time > ?2 and upload_customs_clearance_form_time < ?3", nativeQuery = true)
    Double sumByAdminUserIdAndUploadCustomsClearanceFormTime( Long adminUserId, String startDealTime, String endDealTime);
}
